package celiasoft.itasalibtest;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadPoolExecutor;

import android.util.Log;

public class AsyncQueryLoader {

	protected static final String TAG = "AsyncQueryLoader";
	private ScheduledThreadPoolExecutor _executors;

	public AsyncQueryLoader(){
		this._executors = new ScheduledThreadPoolExecutor(5, new RejectedExecutionHandler(){

			public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
				Log.d(TAG + ".RejectedExecutionHandler", "task:" +  r.toString() + " aborted");
			}
		});
	}
	
	public void load(Runnable query){
		this._executors.submit(query);
	}
	
}
